package com.gy.spark.core.transformations

import org.apache.spark.{SparkConf, SparkContext}

object Operator_intersection_substract {
  def main(args: Array[String]): Unit = {

    val conf = new SparkConf()
    conf.setMaster("local").setAppName(this.getClass.getSimpleName)

    val sc = new SparkContext(conf)
    val rdd1 = sc.makeRDD(List(1, 2, 3, 4))
    val rdd2 = sc.makeRDD(List(1, 2, 5, 6))

    rdd1.intersection(rdd2).foreach(println)

    println("==============")

    rdd1.subtract(rdd2).foreach(println)


    sc.stop()

  }
}
